package com.kehutong.crm.message.admin;

import org.coraframework.authz.HasPermission;
import org.coraframework.inject.Inject;
import org.coraframework.json.JSONObject;
import org.coraframework.mvc.MvcAction;
import org.coraframework.mvc.http.Bean;
import org.coraframework.mvc.http.ReqMapping;
import org.coraframework.mvc.http.result.Result;
import com.kehutong.crm.message.entity.MessageTemplateApp;
import com.kehutong.crm.message.service.MessageAppService;

/**
 * 管理后台-消息管理-应用消息模板管理
 */
@MvcAction
@ReqMapping("/admin/crm/message/app")
public class MessageAppController {

    @Inject
    private MessageAppService appService;

    @HasPermission("crm:message:app:view")
    @ReqMapping("/list/page")
    public Object listPage(JSONObject jsonObject) {
        return appService.listPage(jsonObject);
    }

    @HasPermission("crm:message:app:add")
    @Bean(newInstance=true, copy=true)
    @ReqMapping("/save")
    public Object save(MessageTemplateApp app) {
        return appService.save(app);
    }

    @HasPermission("crm:message:app:edit")
    @Bean(copy=true)
    @ReqMapping("/update")
    public Object update(MessageTemplateApp app) {
        return appService.update(app);
    }

    @HasPermission("crm:message:app:del")
    @ReqMapping("/delete")
    public Object delete(MessageTemplateApp app) {
        return appService.delete(app);
    }

    @ReqMapping("/get")
    public Object get(MessageTemplateApp app) {
        return Result.success(app);
    }
}
